#include <bits/stdc++.h>

using namespace std;

class Solution {
public:
    bool checkSubarraySum(vector<int> &nums, int k) {
        int N = nums.size();
        vector<unsigned long long> sum(N, 0);
        sum[0] = nums[0];
        unordered_map<int, int> hash;
        hash[sum[0] % k] = 0;
        for (int i = 1; i < N; ++i) {
            sum[i] = sum[i - 1] + nums[i];
            int tmp = sum[i] % k;
            if (!tmp)return true;
            if (hash.find(tmp) == hash.end())
                hash[tmp] = i;
            else if (i - hash[tmp] > 1)
                return true;
        }
        return false;
    }
};

int main() {
    Solution solution;
}
